package com.jiyun.order.controller;


import com.jiyun.order.service.IVehicleDemandInfoService;
import com.jiyun.orders.pojo.VehicleDemandInfo;
import com.jiyun.orders.vo.ResultVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 车辆需求信息表 前端控制器
 * </p>
 *
 * @author 1823.
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/vehicle")
public class VehicleDemandInfoController {


    @Autowired
    private IVehicleDemandInfoService vehicleDemandInfoService;

    @Operation(summary = "获取所有车辆信息")
    @RequestMapping("/getAllVehicle")
    public ResultVo getAllVehicleDemandInfo() {
        return ResultVo.ok(vehicleDemandInfoService.list());
    }

    @Operation(summary = "添加车辆信息")
    @PostMapping("/addVehicle")
    public ResultVo addVehicleDemandInfo(@RequestBody VehicleDemandInfo vehicleDemandInfo) {
        vehicleDemandInfoService.save(vehicleDemandInfo);
        return ResultVo.ok();
    }

    @Operation(summary = "车辆详情")
    @RequestMapping("/getVehicleByOrderId/{id}")
    public ResultVo getVehicleDemandInfo(@PathVariable Integer id) {
        return ResultVo.ok(vehicleDemandInfoService.getById(id));
    }
}
